from rest_framework import serializers
from .models import OrderInfo,OrderGoods,Payment,Addr

class InfoSer(serializers.ModelSerializer):
    user_name = serializers.SerializerMethodField(read_only=True)
    def get_user_name(self,obj):
        return obj.user.username
    class Meta:
        model = OrderInfo
        fields = '__all__'

class OrderSer(serializers.ModelSerializer):
    class Meta:
        model = OrderGoods
        fields ='__all__'

class AddSer(serializers.ModelSerializer):
    class Meta:
        model = Addr
        fields = '__all__'

class PaySer(serializers.ModelSerializer):
    class Meta:
        model = Payment
        fields = '__all__'